home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / spar372.zip / SANA2.H < prev    next >
C/C++ Source or Header  |  1993-01-11  |  9KB  |  256 lines

  1. #ifndef SANA2_SANA2DEVICE_H
  2. #define SANA2_SANA2DEVICE_H 1
  3. /*
  4. **      $Filename: devices/sana2.h $
  5. **      $Revision: 1.11 $
  6. **      $Date: 92/11/10 13:35:29 $
  7. **
  8. **      Structure definitions for SANA-II devices.
  9. **
  10. **      (C) Copyright 1991 Commodore-Amiga Inc.
  11. **              All Rights Reserved
  12. */
  13.  
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef EXEC_PORTS_H
  20. #include <exec/ports.h>
  21. #endif
  22.  
  23. #ifndef EXEC_IO_H
  24. #include <exec/io.h>
  25. #endif
  26.  
  27. #ifndef EXEC_ERRORS_H
  28. #include <exec/errors.h>
  29. #endif
  30.  
  31. #ifndef DEVICES_TIMER_H
  32. #include <devices/timer.h>
  33. #endif
  34.  
  35. #ifndef UTILITY_TAGITEM_H
  36. #include <utility/tagitem.h>
  37. #endif
  38.  
  39.  
  40. #define SANA2_MAX_ADDR_BITS     (128)
  41. #define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
  42.  
  43. struct IOSana2Req
  44. {
  45.         struct IORequest ios2_Req;
  46.         ULONG ios2_WireError;           /* wire type specific error     */
  47.         ULONG ios2_PacketType;          /* packet type                  */
  48.         UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES];       /* source addr  */
  49.         UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES];       /* dest address */
  50.         ULONG ios2_DataLength;          /* length of packet data        */
  51.         VOID *ios2_Data;                /* packet data                  */
  52.         VOID *ios2_StatData;            /* statistics data pointer      */
  53.         VOID *ios2_BufferManagement;    /* see SANA-II OpenDevice adoc  */
  54. };
  55.  
  56.  
  57. /*
  58. ** defines for the io_Flags field
  59. */
  60. #define SANA2IOB_RAW    (7)             /* raw packet IO requested      */
  61. #define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
  62.  
  63. #define SANA2IOB_BCAST  (6)             /* broadcast packet (received)  */
  64. #define SANA2IOF_BCAST  (1<<SANA2IOB_BCAST)
  65.  
  66. #define SANA2IOB_MCAST  (5)             /* multicast packet (received)  */
  67. #define SANA2IOF_MCAST  (1<<SANA2IOB_MCAST)
  68.  
  69. #define SANA2IOB_QUICK  (IOB_QUICK)     /* quick IO requested (0)       */
  70. #define SANA2IOF_QUICK  (IOF_QUICK)
  71.  
  72.  
  73. /*
  74. ** defines for OpenDevice() flags
  75. */
  76. #define SANA2OPB_MINE   (0)             /* exclusive access requested   */
  77. #define SANA2OPF_MINE   (1<<SANA2OPB_MINE)
  78.  
  79. #define SANA2OPB_PROM   (1)             /* promiscuous mode requested   */
  80. #define SANA2OPF_PROM   (1<<SANA2OPB_PROM)
  81.  
  82.  
  83. /*
  84. ** defines for OpenDevice() tags
  85. */
  86. #define S2_Dummy        (TAG_USER + 0xB0000)
  87.  
  88. #define S2_CopyToBuff   (S2_Dummy + 1)
  89. #define S2_CopyFromBuff (S2_Dummy + 2)
  90.  
  91.  
  92. struct Sana2DeviceQuery
  93. {
  94. /*
  95. ** Standard information
  96. */
  97.         ULONG   SizeAvailable;          /* bytes available              */
  98.         ULONG   SizeSupplied;           /* bytes supplied               */
  99.         ULONG   DevQueryFormat;         /* this is type 0               */
  100.         ULONG   DeviceLevel;            /* this document is level 0     */
  101. /*
  102. ** Common information
  103. */
  104.         UWORD   AddrFieldSize;          /* address size in bits         */
  105.         ULONG   MTU;                    /* maximum packet data size     */
  106.         ULONG   BPS;                    /* line rate (bits/sec)         */
  107.         ULONG   HardwareType;           /* what the wire is             */
  108. /*
  109. ** Format specific information
  110. */
  111. };
  112.  
  113.  
  114. /*
  115. ** defined Hardware types
  116. **
  117. **  If your hardware type isn't listed below contact CATS to get a new
  118. **  type number added for your hardware.
  119. */
  120. #define S2WireType_Ethernet             1
  121. #define S2WireType_IEEE802              6
  122. #define S2WireType_Arcnet               7
  123. #define S2WireType_LocalTalk            11
  124. #define S2WireType_DyLAN                12
  125.  
  126. #define S2WireType_AmokNet              200
  127.  
  128. #define S2WireType_PPP                  253
  129. #define S2WireType_SLIP                 254
  130. #define S2WireType_CSLIP                255
  131.  
  132.  
  133. struct Sana2PacketTypeStats
  134. {
  135.         ULONG PacketsSent;              /* transmitted count            */
  136.         ULONG PacketsReceived;          /* received count               */
  137.         ULONG BytesSent;                /* bytes transmitted count      */
  138.         ULONG BytesReceived;            /* bytes received count         */
  139.         ULONG PacketsDropped;           /* packets dropped count        */
  140. };
  141.  
  142.  
  143. struct Sana2SpecialStatRecord
  144. {
  145.         ULONG Type;                     /* statistic identifier         */
  146.         ULONG Count;                    /* the statistic                */
  147.         char *String;                   /* statistic name               */
  148. };
  149.  
  150.  
  151. struct Sana2SpecialStatHeader
  152. {
  153.         ULONG RecordCountMax;           /* room available               */
  154.         ULONG RecordCountSupplied;      /* number supplied              */
  155.         /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  156. };
  157.  
  158.  
  159. struct Sana2DeviceStats
  160. {
  161.         ULONG PacketsReceived;          /* received count               */
  162.         ULONG PacketsSent;              /* transmitted count            */
  163.         ULONG BadData;                  /* bad packets received         */
  164.         ULONG Overruns;                 /* hardware miss count          */
  165.         ULONG Unused;                   /* Unused field                 */
  166.         ULONG UnknownTypesReceived;     /* orphan count                 */
  167.         ULONG Reconfigurations;         /* network reconfigurations     */
  168.         struct timeval LastStart;       /* time of last online          */
  169. };
  170.  
  171.  
  172. /*
  173. ** Device Commands
  174. */
  175. #define S2_START                (CMD_NONSTD)
  176.  
  177. #define S2_DEVICEQUERY          (S2_START+ 0)
  178. #define S2_GETSTATIONADDRESS    (S2_START+ 1)
  179. #define S2_CONFIGINTERFACE      (S2_START+ 2)
  180. #define S2_ADDMULTICASTADDRESS  (S2_START+ 5)
  181. #define S2_DELMULTICASTADDRESS  (S2_START+ 6)
  182. #define S2_MULTICAST            (S2_START+ 7)
  183. #define S2_BROADCAST            (S2_START+ 8)
  184. #define S2_TRACKTYPE            (S2_START+ 9)
  185. #define S2_UNTRACKTYPE          (S2_START+10)
  186. #define S2_GETTYPESTATS         (S2_START+11)
  187. #define S2_GETSPECIALSTATS      (S2_START+12)
  188. #define S2_GETGLOBALSTATS       (S2_START+13)
  189. #define S2_ONEVENT              (S2_START+14)
  190. #define S2_READORPHAN           (S2_START+15)
  191. #define S2_ONLINE               (S2_START+16)
  192. #define S2_OFFLINE              (S2_START+17)
  193.  
  194. #define S2_END                  (S2_START+18)
  195.  
  196.  
  197. /*
  198. ** defined errors for io_Error  (see also <exec/errors.h>)
  199. */
  200. #define S2ERR_NO_ERROR          0       /* peachy-keen                  */
  201. #define S2ERR_NO_RESOURCES      1       /* resource allocation failure  */
  202. #define S2ERR_BAD_ARGUMENT      3       /* garbage somewhere            */
  203. #define S2ERR_BAD_STATE         4       /* inappropriate state          */
  204. #define S2ERR_BAD_ADDRESS       5       /* who?                         */
  205. #define S2ERR_MTU_EXCEEDED      6       /* too much to chew             */
  206. #define S2ERR_NOT_SUPPORTED     8       /* hardware can't support cmd   */
  207. #define S2ERR_SOFTWARE          9       /* software error detected      */
  208. #define S2ERR_OUTOFSERVICE      10      /* driver is OFFLINE            */
  209. /*
  210. ** From <exec/errors.h>
  211. **
  212. **      IOERR_OPENFAIL   (-1) * device/unit failed to open *
  213. **      IOERR_ABORTED    (-2) * request terminated early [after AbortIO()] *
  214. **      IOERR_NOCMD      (-3) * command not supported by device *
  215. **      IOERR_BADLENGTH  (-4) * not a valid length (usually IO_LENGTH) *
  216. **      IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
  217. **      IOERR_UNITBUSY   (-6) * device opens ok, but requested unit is busy *
  218. **      IOERR_SELFTEST   (-7) * hardware failed self-test *
  219. */
  220.  
  221. /*
  222. ** defined errors for ios2_WireError
  223. */
  224. #define S2WERR_GENERIC_ERROR    0       /* no specific info available   */
  225. #define S2WERR_NOT_CONFIGURED   1       /* unit not configured          */
  226. #define S2WERR_UNIT_ONLINE      2       /* unit is currently online     */
  227. #define S2WERR_UNIT_OFFLINE     3       /* unit is currently offline    */
  228. #define S2WERR_ALREADY_TRACKED  4       /* protocol already tracked     */
  229. #define S2WERR_NOT_TRACKED      5       /* protocol not tracked         */
  230. #define S2WERR_BUFF_ERROR       6       /* buff mgt func returned error */
  231. #define S2WERR_SRC_ADDRESS      7       /* source address problem       */
  232. #define S2WERR_DST_ADDRESS      8       /* destination address problem  */
  233. #define S2WERR_BAD_BROADCAST    9       /* broadcast address problem    */
  234. #define S2WERR_BAD_MULTICAST    10      /* multicast address problem    */
  235. #define S2WERR_MULTICAST_FULL   11      /* multicast address list full  */
  236. #define S2WERR_BAD_EVENT        12      /* unsupported event class      */
  237. #define S2WERR_BAD_STATDATA     13      /* statdata failed sanity check */
  238. #define S2WERR_IS_CONFIGURED    15      /* attempt to config twice      */
  239. #define S2WERR_NULL_POINTER     16      /* null pointer detected        */
  240.  
  241.  
  242. /*
  243. ** defined events
  244. */
  245. #define S2EVENT_ERROR           (1L<<0) /* error catch all              */
  246. #define S2EVENT_TX              (1L<<1) /* transmitter error catch all  */
  247. #define S2EVENT_RX              (1L<<2) /* receiver error catch all     */
  248. #define S2EVENT_ONLINE          (1L<<3) /* unit is in service           */
  249. #define S2EVENT_OFFLINE         (1L<<4) /* unit is not in service       */
  250. #define S2EVENT_BUFF            (1L<<5) /* buff mgt function error      */
  251. #define S2EVENT_HARDWARE        (1L<<6) /* hardware error catch all     */
  252. #define S2EVENT_SOFTWARE        (1L<<7) /* software error catch all     */
  253.  
  254.  
  255. #endif  /* SANA2_SANA2DEVICE_H */
  256.